{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}

{% block page_title %} 任务详情 {% endblock %}

{% block page_content %}  

<!-- 任务展示 -->
<div>
<h2>{{ task.task_name }}</h2>
<p>{{ task.task_description }}</p>
<p>{{ task.task_deadline }}</p>
{% if current_user.isAdmin() %}
<button><a href="{{ url_for('main.downloadTask',id=task.id) }}">下载任务集</a></button>
<button><a href="{{ url_for('main.deleteTask',id=task.id) }}">删除任务</a></button>
{% endif %}
<ul>
{% for t in taskList %}
{% if task.task_name not in t %}
    <li>{{ t }}{% if current_user.username in t %}<a href="{{ url_for('main.deleteFile',id=task.id,filePath=t) }}">删除</a>{% endif %}</li>
{% endif %}
{% endfor %}
</ul>
</div>

<!-- 上传任务 -->
{% if form %}
<div>
<form action="/upload" method="post" class="form" enctype="multipart/form-data" role="form">
    {{ form.csrf_token }} 
    <input type="hidden" id="taskId" name="taskId" value="{{ task.id }}">   
    <input id="file" name="file" required type="file">      
    <input class="btn btn-default" id="submit" name="submit" type="submit" value="上传">   
</form>
</div>
{% endif %}

{% endblock %}